<!--<!DOCTYPE html>-->
<!--<html lang="en">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>Hello</title>-->
<!--    <script src="lib/vue.js"></script>-->
<!--</head>-->
<!--<body>-->
<!--<div id="app">-->
<!--    <my-header></my-header>-->
<!--    <my-header></my-header>-->
<!--    <my-header></my-header>-->
<!--</div>-->
<!--<script>-->
<!--    Vue.component("my-header", {-->
<!--        template: `<header>-->
<!--                        标题 - {{ msg }}-->
<!--                        <button @click="add">{{count}}</button>-->
<!--                    </header>`,-->
<!--        data(){-->
<!--            return {-->
<!--                msg: "hello component",-->
<!--                count: 0,-->
<!--            }-->
<!--        },-->
<!--        methods:{-->
<!--            add(){-->
<!--                this.count++;-->
<!--            }-->
<!--        }-->
<!--    });-->
<!--    new Vue().$mount("#app");-->
<!--</script>-->
<!--</body>-->
<!--</html>-->

<!doctype html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>01Prc全局注册组件</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="app">
    <my-header></my-header>
    <my-header></my-header>
    <my-header></my-header>
</div>
<template id="header">
    <header>
        标题 - {{msg}}
        <button @click="add">{{count}}</button>
    </header>
</template>
</body>

<script>
    Vue.component("my-header", {
        template: `#header`,
        data() {
            return {
                msg: "hello component",
                count: 1
            }
        },
        methods: {
            add() {
                this.count++;
            }
        }
    })
    new Vue().$mount("#app");
</script>

</html>